<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>活动管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="../../../static/images/favicon.ico" th:href="@{/images/favicon.ico}">
    <link rel="stylesheet" href="../../../static/plugin/layui/css/layui.css" th:href="@{/plugin/layui/css/layui.css}" media="all" />
    <link rel="stylesheet" href="../../../static/back_css/public.css" th:href="@{/back_css/public.css}" media="all" />
    <link rel="stylesheet" href="../../../static/back_css/activity_management.css" th:href="@{/back_css/activity_management.css}" media="all">
</head>
<body>
    <div class="container">
        <div class="container_top">
            <div style="display: none">
                <input type="text" id="searchText" th:value="${name}" name="name" placeholder="请输入关键字">
                <a href="#" id="serach"> </a>
            </div>
        </div>
        <div class="container_content">
            <table class="layui-hide" id="activityTable" lay-filter="activityTable"></table>
        </div>
    </div>

    <script type="text/javascript" src="../../../static/plugin/layui/layui.js" th:src="@{/plugin/layui/layui.js}"></script>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs" data-method="notice" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" >删除</a>
    </script>
    <script type="text/javascript" th:inline="none">
        layui.use(['table', 'layer', 'form'], function () {
            var table = layui.table;
            var $ = layui.jquery;
            var form = layui.form;
            table_render('/getAllActivity');
            function table_render(url) {
                table.render({
                    elem: '#activityTable',
                    width: 980,
                    even: true,
                    page: true,
                    url: url,
                    limit: 20,
                    limits: [20],
                    id: 'idActivityTable', 
                    cols: [[
                        {type: 'checkbox', fixed: 'left', style: 'display:none'},
                        {field: 'activity_ID', width: 100, title: '序号'},
                        {field: 'activity_ACCOUNT', width: 120, title: '活动标题'},
                        {field: 'activity_TOPIC',  title: '活动主题',hide:true},
                        {field: 'activity_TYPE', width: 143, title: '推荐单位'},
                        {field: 'activity_STARTTIME', width: 142, title: '活动开始时间'},
                        {field: 'activity_ENDTIME', width: 110, title: '活动结束时间'},
                        {field: 'activity_IMG', width: 170, title: '活动封面'},
                        {field: 'create_TIME', width: 170, title: '发布时间' },
                        {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 190}
                    ]]
                });
            }

            active = {
                reload: function () {
                    var demoReload = $('#demoReload');
                    table.reload('idActivityTable', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }, 
                        where: {
                            id: demoReload.val()
                        }
                    });
                }
            };

            $('.layui-btns').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    </script>
</body>
</html>
